package com.ugoodtech.mdcc.web.controller;

import com.ugoodtech.mdcc.core.domain.AutoBrand;
import com.ugoodtech.mdcc.core.domain.StationCategory;
import com.ugoodtech.mdcc.core.domain.User;
import com.ugoodtech.mdcc.core.repository.DepartmentRepository;
import com.ugoodtech.mdcc.core.repository.UserRepository;
import com.ugoodtech.mdcc.core.utils.BaseUtil;
import com.ugoodtech.mdcc.web.dto.JsonResponse;
import com.ugoodtech.mdcc.web.dto.CustomerSatisfactionReportResponse;
import com.ugoodtech.mdcc.web.service.UserService;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Copyright © 2013 All Rights Reserved, Ugood Technology, Inc.
 */

@Api(description = "60分预警")
@Controller
@RequestMapping("/customerSatisfactionReport")
public class CustomerSatisfactionReportController extends BaseController {

    private static final Logger logger = LoggerFactory.getLogger(CustomerSatisfactionReportController.class);
    @Autowired
    UserRepository systemUserRepository;
    @Autowired
    UserService systemUserService;

    @Autowired
    DepartmentRepository departmentRepository;

    @Autowired
    private PasswordEncoder passwordEncoder;


    @ApiOperation("列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "data", response = User.class)
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页数", required = false, paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "size", value = "每页条数", required = false, paramType = "query", dataType = "int"),
    })
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public JsonResponse getAllDepartment(@ApiParam("省份") @RequestParam(value = "province", required = false) String province,
                                         @ApiParam("城市") @RequestParam(value = "city", required = false) String city,
                                         @ApiParam("维修站类型") @RequestParam(value = "category", required = false) StationCategory category,
                                         @ApiParam("品牌") @RequestParam(value = "brand", required = false) AutoBrand brand,
                                         @ApiParam("关键字") @RequestParam(value = "param", required = false) String param,
                                         @ApiParam("外勤人员关键字") @RequestParam(value = "userParam", required = false) String userParam,
                                         @ApiParam("维修站编号") @RequestParam(value = "stationNum", required = false) String stationNum,
                                         Pageable pageable) {
        isUserLogin();
//        Page<CustomerSatisfactionReport> customerSatisfactionReport = customerSatisfactionReportService.queryReport(pageable);
//        Page<CustomerSatisfactionReport> customerSatisfactionReport=new PageImpl<CustomerSatisfactionReport>(new ArrayList<CustomerSatisfactionReport>());
        //        for(Department department:departments){
//            setChildren(department);
//        }
//        return JsonResponse.successResponseWithPageData(BaseUtil.getDtoPage(customerSatisfactionReport,pageable, CustomerSatisfactionReportResponse.class));
        return null;
    }


//    @ApiOperation("删除维修站")
//    @RequestMapping(value = "/delete", method = RequestMethod.POST)
//    public JsonResponse delete(@ApiParam(value = "用户数据库id", required = true) @RequestParam(value = "customerSatisfactionReportId") Long customerSatisfactionReportId) {
//        isUserLogin();
//        CustomerSatisfactionReport customerSatisfactionReport = customerSatisfactionReportRepository.findOne(customerSatisfactionReportId);
//        customerSatisfactionReport.setDeleted(true);
//        customerSatisfactionReportRepository.save(customerSatisfactionReport);
//        return JsonResponse.successResponse();
//    }


}
